<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css">
    <title>Cobweb</title>
</head>
<body>
<div class="container-fluid">
    <nav class="navbar navbar-light bg-light">
        <a class="navbar-brand" href="/">
            <img src="/assets/images/spider.png" width="30" height="30" class="d-inline-block align-top" alt="logo">
            Cobweb
        </a>
    </nav>

    <form action="" method="get">
        <div class="input-group mb-3">
            <input type="text" name="q" class="form-control" placeholder="请输入关键字" aria-describedby="basic-addon2" value="{{.Query}}">
            <div class="input-group-append">
                <button type="submit" class="input-group-text" id="basic-addon2">Search</button>
            </div>
        </div>
    </form>

    <div class="alert alert-secondary" role="alert">
        共为您找到相关结果约为 {{.Hits}} 条，显示从第 {{.Start}} 起共 {{len .Items}} 个。
    </div>

    <table class="table">
        <thead class="thead-dark">
        <tr>
            <th scope="col">姓名</th>
            <th scope="col">性别</th>
            <th scope="col">年龄</th>
            <th scope="col">身高</th>
            <th scope="col">体重</th>
            <th scope="col">收入</th>
            <th scope="col">教育</th>
            <th scope="col">职业</th>
            <th scope="col">星座</th>
            <th scope="col">购房情况</th>
            <th scope="col">购车情况</th>
        </tr>
        </thead>
        <tbody>
        {{range .Items}}
        <tr>
            <td><a href="{{.Url}}" target="_blank">{{.Payload.Name}}</a></td>
        {{with .Payload}}
            <td>{{.Gender}}</td>
            <td>{{.Age}}</td>
            <td>{{.Height}}cm</td>
            <td>{{.Weight}}kg</td>
            <td>{{.Income}}</td>
            <td>{{.Education}}</td>
            <td>{{.Occupation}}</td>
            <td>{{.Constellation}}</td>
            <td>{{.House}}</td>
            <td>{{.Car}}</td>
        {{end}}
        </tr>
        {{else}}
        <tr><td colspan="11">没有找到记录</td></tr>
        {{end}}
        </tbody>
    </table>

    <nav aria-label="Page navigation example">
        <ul class="pagination">
            {{if ge .PrevFrom 1}}
                <li class="page-item"><a class="page-link" href="/search?q={{.Query}}&from={{.PrevFrom}}">Prev</a></li>
            {{else}}
                <li class="page-item"><a class="page-link" href="javascript:void(0);">Prev</a></li>
            {{end}}
            <li class="page-item"><a class="page-link" href="/search?q={{.Query}}&from={{.NextFrom}}">Next</a></li>
        </ul>
    </nav>
</div>
<script src="http://cdn.bootcss.com/jquery/3.2.1/jquery.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="http://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="http://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>